﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Hal.Zip.WPF.GUI
{
	/// <summary>
	/// Interaction logic for frmPassword.xaml
	/// </summary>
	public partial class frmPassword : Window
	{
		private string _sPassword = "";
		private bool _bDidCancel = true;

		public string Password
		{
			get { return _sPassword; }
			set { _sPassword = value; }
		}

		public bool DidCancel
		{
			get { return _bDidCancel; }
			set { _bDidCancel = value; }
		}
		public frmPassword()
		{
			InitializeComponent();
		}

		private void btnJustZip_Click(object sender, RoutedEventArgs e)
		{
			_sPassword = "";
			_bDidCancel = false;
			this.Close();
		}

		private void btnZipAndEncrypt_Click(object sender, RoutedEventArgs e)
		{
			if((txtPassword2.Text.Length < 1) || (txtPassword2.Text != txtPassword3.Text))
			{
				MessageBox.Show("Please enter matching passwords to continue or click 'Return'.");
				return;
			}
			_sPassword = txtPassword3.Text.Trim();
			_bDidCancel = false;
			this.Close();
		}

		private void btnReturn_Click(object sender, RoutedEventArgs e)
		{
			this.Close();
		}
	}
}
